﻿using WebSocketSharp.Server;

namespace FileClient.Wpf.Ws;

public class ClientWsListener : IClientWsListener
{
    private WebSocketServer _server;

    public int? Port => _server?.Port;

    public void Listen()
    {
        _server = new WebSocketServer(10091);
        _server.AddWebSocketService<FileService>("/ws");
        _server.Start();
    }

    public void Dispose()
    {
        _server?.Stop();
    }
}